
var Brick = function(game, position){
    var p = position
    var o = game.imgByName("brick")
    o.x = p[0]
    o.y = p[1]
    o.w = o.img.width
    o.h = o.img.height
    o.lives = p[2] || 1
    o.alive = true
    o.kill = function(){
        o.lives --
        socre += 100
        if (!o.lives){
            o.alive = false
        }
    }
    o.collide = function(ball){
        return o.alive && collide(o, ball)
    }

    return o
}